using System;
using System.Drawing;
using System.Xml.Serialization;

namespace DataAccessLayer
{
    [Serializable, XmlType("Point")]
    public struct EditorVector2
    {
        [XmlAttribute]
        public float X { get; set; }

        [XmlAttribute]
        public float Y { get; set; }

        public EditorVector2(float x, float y) : this()
        {
            X = x;
            Y = y;
        }

        public static implicit operator EditorVector2(PointF value)
        {
            return new EditorVector2(value.X, value.Y);
        }

        public static implicit operator EditorVector2(Point value)
        {
            return new EditorVector2(value.X, value.Y);
        }

        public static implicit operator PointF(EditorVector2 value)
        {
            return new PointF(value.X, value.Y);
        }

        public static implicit operator Point(EditorVector2 value)
        {
            return new Point((int)value.X, (int)value.Y);
        }
    }
}